extends layout

block content
  h1= 图片共享
  .row
    .col-12.col-md-8.mt-2
      .card
        .card-header.bg-primary.text-white 上传图片
        .card-body
          form(action="/upload", method="post", enctype="multipart/form-data")
            .form-group.row
              label.col-12.col-md-3.col-form-label 选择图像
              .col-12.col-md-9
                input.form-control(type="file", name="imgfile")
            .form-group.row
              label.col-12.col-md-3.col-form-label 标题
              .col-12.col-md-9
                input.form-control(type="text", name="title")
            .form-group.row
              label.col-12.col-md-3.col-form-label 描述
              .col-12.col-md-9
                textarea.form-control(rows="3", name="description")
            .row
              .offset-8.col-4             
                button.form-control.btn.btn-primary(type="submit")
                  i.fa.fa-cloud-upload.mr-2
                  | 上传图片
      .card.mt-2
        .card-header 最新图片
        .card-body 
          .row
            each image in images
              .col-12.col-md-4.mt-2
                a(href='/image/' + image._id)
                  .card
                    img.card-img-top(src='/' + image.imagepath)
    .col-12.col-md-4.mt-2
        include sider.pug

